perf(docker): replace subprocess spawning with Docker Engine HTTP API#44
Merged
Conversation
Switch from shelling out to the `docker` CLI binary to using dockerode, which communicates directly with the Docker socket. This eliminates per-query process fork/exec overhead (~100-200ms per container). Other improvements: - Fix line buffering: properly handle log lines spanning chunk boundaries - Pre-compile log pattern regexes in the constructor instead of per-line - Deliver incremental results as each container completes (onBatchDone) - Remove noisy console.log/warn calls from hot paths BREAKING: `binaryLocation` param removed — no longer needed since the adapter talks directly to the Docker Engine API via `dockerHost`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
child_process.spawncalls withdockerode(Docker Engine HTTP API via unix socket), eliminating ~100-200ms of process fork/exec overhead per container per querydata.split(/(\r?\n)/g)used a capturing group and had no cross-chunk buffer, silently dropping log lines that spanned pipe chunk boundariesnew RegExp()on every log lineonBatchDoneas each container completes, instead of waiting for all containers to finishconsole.log/console.warncalls from hot pathsBREAKING:
binaryLocationparam removed — the adapter now talks directly to the Docker Engine API viadockerHostinstead of shelling out to thedockerCLI binary.Test plan